import request from '../utils/request.js'

// 验证码接口
export function sendCode(data) {
	return request.post("https://ucenter-api.xgimi.com/v1/identity/sendCode", data)
}

// 登录接口
export function smsLogin(data) {
	return request.post("https://ucenter-api.xgimi.com/v1/sso/smsLogin", data)
}

// 检查登录
export function checkLogin() {
	return request.get("https://ucenter-api.xgimi.com/open/oauth2/login/checkLogin")
}

// 搜索提示
export function getSuggestionList(params) {
	return request.get("https://sp2.xgimi.com/productSearch/getSuggestionList", params)
}

// 搜索
export function getResultList(params) {
	console.log("params", params)
	return request.get("https://sp2.xgimi.com/productSearch/getResultList", params)
}

// 推荐
export function getList() {
	return request.get("https://sp2.xgimi.com/hotProduct/getList")
}

// 加入购物车
export function addCart(data) {
	return request.post("https://sp2.xgimi.com/api/addcart", data)
}

// 详情
export function getBasicInfo(params) {
	return request.get("https://mall-gateway.i.xgimi.com/mall/sku/detail/basic_info", params)
}


// 首页幻灯片
export function GetNewProduct() {
	return request.get("https://mall-gateway.i.xgimi.com/mall/home/new_product")
}

// 获取推荐
export function GetComer() {
	return request.get("https://mall-gateway.i.xgimi.com/mall/newcomer/scene_list")
}

// 获取首页列表
export function GetHomeCategoryList() {
	return request.get("https://mall-gateway.i.xgimi.com/mall/home/category_list")
}

// 获取购物车商品数量
export function GetCartTotal() {
	return request.get("https://sp2.xgimi.com/getCartTotalProductAmount")
}

// 获取购物车数据
export function getCart() {
	return request.post("https://sp2.xgimi.com/api/cart")
}
// 修改checked
export function checkShop(data) {
	return request.post("https://sp2.xgimi.com/api/checkshopids", data)
}
// 更新购物车数量 
export function updateAmount(data) {
	return request.post("https://sp2.xgimi.com/api/update_amount", data)
}
// 删除购物车数据
export function dropGoods(data) {
	return request.post("https://sp2.xgimi.com/api/dropgoods", data)
}

// 创建订单流程
export function flowCheck(data) {
	return request.get("https://sp2.xgimi.com/flow-check", {
		data
	})
}

// 创建订单
export function createOrder(data) {
	return request.post("https://sp2.xgimi.com/api/placeorder", data);
}

// 获取订单信息
export function getOrder(params) {
	return request.get(`https://sp2.xgimi.com/buy/confirm/${params.orderId}?orderId=${params.orderId}&code=`)
}